package com.qf.web.servlet;

import com.qf.service.EmpService;
import com.qf.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@WebServlet("/deleteEmp")
public class DeleteEmpServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        EmpService service = new EmpServiceImpl();
        //调用service， 执行删除功能
        service.delete(id);

        //跳转： 请求转发， 重定向
        //重定向 到  查询员工操作
        resp.sendRedirect("/selectAllEmp");

    }
}
